package cn.qinchong.mobilesafe.receiver;

import java.util.List;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import cn.qinchong.mobilesafe.utils.Logger;

public class KillTaskReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		Logger.i("KillTaskReceiver","KILLTASK");
		
		ActivityManager am  =(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
		List<RunningAppProcessInfo>  runinfos  =am.getRunningAppProcesses();
		for(RunningAppProcessInfo  info : runinfos){
			am.killBackgroundProcesses(info.processName);
		}
	}

}
